package com.yueka.controller;

import com.yueka.pojo.Result;
import com.yueka.service.StatementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RequestMapping("/statement")
@RestController
public class StatementController {

    @Autowired
    private StatementService statementService;

    @RequestMapping("/getStatement")
    public Result getStatement() {
        try {
            return Result.success(statementService.getStatement());
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }

    @RequestMapping("/getStudentTrend")
    public Result getStudentTrend(String start, String end) {
        try {
            return Result.success(statementService.getStudentTrend(start, end));
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }

    @RequestMapping("/getRourseRecordTrend")
    public Result getRourseRecordTrend(String start, String end) {
        try {
            return Result.success(statementService.getRourseRecordTrend(start, end));
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
}
